{% for link in linklist  %}
  <h4 {% if page.url contains link.permalink %}class="active"{% endif %}>
    {{ link.title }}
  </h4>
  <ul>
    {% for child in link.children %}
      {% capture dropdown %}{{ child.children | size }}{% endcapture %}
      {% if dropdown == '0' %}
        {% capture page_without_index %}{{ page.url | remove: '/index' }}{% endcapture %}
        <li {% if page_without_index == child.permalink %}class="active"{% endif %}>
          <a href="{{ child.permalink }}" title="{{ child.title }}">{{ child.title }}</a>
        </li>
      {% else %}
        <li {% if page.url contains child.permalink %}class="active"{% endif %}>
          <a href="{{ child.permalink }}" title="{{ child.title }}">{{ child.title }}</a>
          <i class="icon icon-arrow"></i>
          <ul>
            {% for c in child.children %}
              <li {% if page.url contains c.permalink %}class="active"{% endif %}>
                <a href="{{ c.permalink }}" title="{{ c.title }}">{{ c.title }}</a>
              </li>
            {% endfor %}
          </ul>
      {% endif %}
    {% endfor %}
  </ul>
{% endfor %}
